package gsp

import (
	"net/http"

	"gitee.com/go-spring2/spring-core/gs"
	"gitee.com/go-spring2/spring-core/web"
)

func GetBinding(path string, fn interface{}) *web.Mapper {
	return gs.HandleGet(path, REST(fn))
}

func PostBinding(path string, fn interface{}) *web.Mapper {
	return gs.HandlePost(path, REST(fn))
}

func PutBinding(path string, fn interface{}) *web.Mapper {
	return gs.HandlePut(path, REST(fn))
}

func DeleteBinding(path string, fn interface{}) *web.Mapper {
	return gs.HandleDelete(path, REST(fn))
}

func HttpGet(path string, h http.Handler) *web.Mapper {
	return gs.HttpGet(path, func(w http.ResponseWriter, r *http.Request) {
		h.ServeHTTP(w, r)
	})
}
